<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/talk.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_json.js"></script>
<script src="js/login.js"></script>
<script src="js/config.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<div id="main" class="loading" >
</div>
</body>
<script>
	zy_init();
	var Users = new Users({});
	
	var page=1;
	
	function oklogin(msg){
		uexWindow.toast("0", "5", msg, 5000);
		GetUrl(0);
	}
	
	function GetUrl(t){
		if(localStorage['tweet_list_user'] == 1 && !Users.checkUser()){
			localStorage['login']="tweet";
			uexWindow.open('login', '0', 'login.html', 2, '', '', 0x0);
			return false;
		}
		
		if (t == -1) {
			$$('main').className="loading";
		}
		if(t<1){
			page=1;
		}

		var user = localStorage['tweet_list_user'] == 1 ? localStorage['uid'] : localStorage['tweet_list_user'];

		var url = OpenAPI.tweet_list+'/?client_id='+OpenAPI.client_id+'&dataType=json&user='+user+'&page='+(t<1?1:page);
		uexXmlHttpMgr.open(t,'post',url,"8000");
		uexXmlHttpMgr.send(t);
	}

	window.uexOnload=function(type){
		if(!type){
			uexWindow.setBounce("1");
			uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
			uexWindow.setBounceParams("1",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"","pullToReloadText":"上拉加载更多","releaseToReloadText":"释放加载","loadingText":"加载中，请稍等"}');
	　　　　	uexWindow.showBounceView("0","#f3f3f3","1");
	　　　　	uexWindow.notifyBounceEvent("0","1");
			uexWindow.showBounceView("1","#f3f3f3","1");
　　　　		if(localStorage['tweet_list_user'] != -1) uexWindow.notifyBounceEvent("1","1");
			uexWindow.onBounceStateChange=function(t,s){
	　　　　　　	if(t=="0"||t=="1"){//下方弹动时
	　　　　　　　　	if(s=="2"){//松开手指时
						GetUrl(t);						
					}
	　　　　　　	}
	　　　　	}
	
			uexXmlHttpMgr.onData = function(opId, status, data){
				uexXmlHttpMgr.close(opId);
				uexWindow.resetBounceView(opId);
				if(status==1){
					if(opId<1){
						uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"上次更新：'+Now()+'","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
						$$("main").className='';
					}
					if(opId==0){
						uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"上次更新：'+Now()+'","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
						$$('main').innerHTML='';
					}
					data=JSON.parse(data);
					var List=data['tweetlist'];
					if(List.length>0){
					    for(k in List){
							var Div;
							Div=document.createElement("div");
							Div.className='talkitem';

							var html ='';
							html += '<div class="avatar" onclick="javascript:user_info('+List[k]['authorid']+');">'+
										'<img src="'+List[k]['portrait']+'">'+
									'</div>'+
									'<div class="talkcontent">'+
										'<h3 onclick="javascript:user_info('+List[k]['authorid']+');">'+List[k]['author']+'</h3>';
										if(List[k]['imgBig'] && List[k]['body'] != '#语音分享#'){
											html += '<div class="img talkloadimg nobg" ontouchstart="zy_touch(\'down\')" onclick="ImageBrowser(\''+List[k]['imgBig']+'\',0);">'+
														'<img src="'+List[k]['imgSmall']+'" class="" onload="loading(this)">'+
													'</div>';
										}
										
								html += '<p onclick="javascript:jump('+List[k]['id']+');">'+List[k]['body']+'</p>'+
										'<div class="btns">'+
											'<div class="date">'+List[k]['pubDate']+'</div>'+
											'<span class="commentb">'+List[k]['commentCount']+'</span>'+
										'</div>'+
									'</div>';
							Div.innerHTML= html;
							$$('main').appendChild(Div);
						}
						
						page++;
					}else{
						if(opId==-1)
						{
							$$("main").className='notdata';
						}				
					}
					
				}else if(status==-1){
					if(opId==-1){
						$$("main").className='errer';
					}else{
						uexWindow.toast("0","5",'加载失败',1000);
					}
				}
			}
			GetUrl(-1);
		}
	}
	
	function loading(obj){
		obj.className='';
		var par=obj.parentNode;
		par.className += ' nobg';  
	}	

	function jump(id){
		localStorage['tweet_id'] = id;
		uexWindow.open('tweet_detail','0','tweet_detail.html','2','', '',0x0);
		
	}
	
	function ok_tweet_pub(){
		uexWindow.toast("0", "5", '后台发布中~', 1000);
		GetUrl(0);
	}
	
	function ImageBrowser(pictureurls,index){
		var data= pictureurls.split(","); 
		uexImageBrowser.open(data, index, 1);
	}
	
	</script>
</html>